-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support reading less options from its script tag data attributes #2243
Conversation
Nice idea. Will have a think but am initially keen on it. |
agreed, would be nice! |
@seven-phases-max What do you think? |
Assuming it's relatively lightweight, why not? |
@lejenome We'll take your other commit too, please, so this also applies to less tags |
done |
Support reading less options from its script tag data attributes
thanks then! |
I would but my English really sucks
|
No problem, myself or someone else will get round to it. |
docs added: less/less-docs@ebf87fc |
This conflicts with RequireJS's <script data-main="js/main.js" src="bower/requirejs/require.js" type="text/javascript"></script> Instead of going through all options at least check for only known ones: var stringOptions = ['env', 'dumpLineNumbers', 'rootpath', 'errorReporting',
jsonOptions = ['...'];
// ...
if (stringOptions.indexOf(opt) != -1) {
options[opt] = tag.dataset[opt];
} else if (jsonOptions.indexOf(opt) != -1) {
options[opt] = JSON.parse(tag.dataset[opt]);
} else {
// do nothing
} |
add support to reading less script tag data attr like this:
it is more easier and cleaner.
if you found this useful, I will send an extra commit that will add support to read data attributes from less files link tag too (useful it needs some specific options per less file like following)